<?php
/**
 * Created by PhpStorm.
 * User: peter
 * Date: 2018/11/2
 * Time: 1:10 PM
 */

namespace app\admin\controller;


use think\Request;

class ActivityOrderRefund extends Auth
{
    /**
     * @purpose 拒绝退款
     * @param Request $request
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * @throws \think\exception\PDOException
     */
    public function refuse (Request $request) {
        $refund_id      = $request->post('refund_id', 0);
        $reason         = $request->post('reason', '');
        return \app\admin\logic\ActivityOrderRefund::refuse($refund_id, $reason, self::$uid);
    }
    /**
     * @purpose 同意退款
     * @param Request $request
     * @return array
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function agree (Request $request)
    {
        $refund_id      = $request->post('refund_id', 0);
        return \app\admin\logic\ActivityOrderRefund::agree($refund_id, self::$uid);
    }
    /**
     * @purpose 获取取消订单中的出现人
     * @param Request $request
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function cancelTravelItems (Request $request)
    {
        $refund_id      = $request->get('refund_id', 0);
        return \app\admin\logic\ActivityOrderRefund::cancelTravelItems($refund_id);
    }
    /**
     * @purpose 获取退款订单列表
     * @param Request $request
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function items (Request $request)
    {
        $status     = $request->get('status', 1);
        $page       = $request->get('page', 1);
        $size       = $request->get('size', 20);
        return \app\admin\logic\ActivityOrderRefund::items($status, $page, $size);
    }
}